package com.share.common.tools.date;

import org.apache.log4j.Logger;

import java.text.SimpleDateFormat;
import java.util.Date;
import java.util.SimpleTimeZone;

/**
 * 时间的工具类
 */
public class DateUtil {
    private static final Logger logger = Logger.getLogger(DateUtil.class);


    /**
     * 生成当前UTC时间戳Time
     * @return String
     */
    public static String generateTimestamp() {
        Date date = new Date(System.currentTimeMillis());
        SimpleDateFormat df = new SimpleDateFormat("yyyy-MM-dd'T'HH:mm:ss'Z'");
        df.setTimeZone(new SimpleTimeZone(0, "GMT"));
        return df.format(date);
    }


    public static void main(String[] args) {
        logger.info(DateUtil.generateTimestamp());
    }
}
